Welcome back to Electronics, this Dr Robinson.
In this lesson we're going to look at a filtering demonstration where we make
measurements using test equipment on an actual circuit.
In your previous lesson you were introduced to second order filter
circuits.
And our objectives for this lesson are to examine frequency spectre of signals and
to demonstrate filtering by a second order filter circuit.
A frequency spectrum is a representation of a time domain waveform
on voltage versus frequency access.
Here I'm showing both a one kilohertz,
one volt amplitude sine wave in the time domain.
And it's representation in the frequency domain or its frequency spectrum.
This is voltage versus time graph.
This is a voltage versus frequency graph.
This sine wave with amplitude 1 and
frequency 1 kilohertz is represented here on this spectrum.
By a single spike at a frequency of 1 kilohertz having amplitude of 1 volt.
Any single spike on a frequency spectrum represents a sine wave in the time domain.
Now let's look at a somewhat more complicated waveform.
Here, I'm adding two sine waves together.
A 1 kilohertz sine wave, shown in blue,
and a 2 kilohertz sine wave shown in green.
The red curve is the summation of the blue curve and the green curve.
So at any time, we can obtain the red curve by adding
the 1 kilohertz sine wave amplitude and the 2 kilohertz sine wave amplitude.
Here I'm showing the spectrum of the sum of the two sine waves, or
the spectrum of this red curve.
And you can see, as you might expect, it's composed of two sinusoidal waveforms.
One at 1 kilohertz with amplitude 1, and one at 2 kilohertz with amplitude 1.
The spectrum is indicating that this
somewhat complicated waveform is obtained by adding two sine waves together.
One at 1 kilohertz, one at 2 kilohertz.
Here I'm showing both a square wave in the time domain and
a partial representation of its frequency spectrum.
The react should be an infinite number of these sinusoidal components.
And must be combined together to give us this square wave in the time domain.
Now this component here at 1 kilohertz is known
as the fundamental at n=1, this is the third harmonic.
This is the fifth harmonic, this is the seventh harmonic.
This sine wave occurs at a currency of 3 kilohertz or
three times the frequency of the fundamental at 1 kilohertz hence, n=3.
This is occurring at 5 kilohertz, this sound wave at 7 kilohertz etc.
Now if we were to say have five function generators,
one function generator generating a 1 kilohertz sine wave with amplitude 1 volt.
Another generating a 3 kilohertz sine wave with this amplitude.
Another at 5 kilohertz, 7 kilohertz, 9 kilohertz etc.
And we took the output from each one of those function generators and
added them with, say, an opamp summing circuit.
Then the output would approximate this square wave.
We would need many,
many more components to make the approximation a better approximation.
Here I'm showing how increasing the number of sine waves to generate
the approximation affects the shape of the square wave in the time domain.
So, for example,
this red curve here, I'm adding this sine wave plus this sine wave to generate it.
And you can see that just two sine waves added together
are already a reasonable approximation to our square wave.
The green curve, I'm adding the first four spectral components,
the fundamental plus the third, fifth and seventh harmonic.
And then the blue curve, a better approximation,
I'm adding the first six spectral components.
But you can see that a square wave can be thought of
as a sum of individual sinusoidal components.
This square wave is composed of these sinusoids added together.
We are now shown the circuit schematic of an opamp circuit known as a relaxation
oscillator.
This circuit produces an output with no signal input.
The only input to this circuit is a DC voltage used to
supply power to this opamp.
When the power supply is turned on at the output, a square wave will be produced.
That oscillates between the V plus rail In the V minus rail of the opamp.
The frequency of the square wave is related to the time constant set by this
R and this C.
It's a simple circuit to build and
actually you could experimentally determine values here to produce
the square wave of the frequency that you desire.
And the square wave could be used say as the input to a MOSFET switch,
turning something on off on off.
But say instead of a square wave you wanted to generate a sinusoidal
output voltage.
Remember the square wave, we can think of it in terms of its spectrum,
where the square wave is composed of individual sine wave components.
Then say that we apply the square wave to the input of a band pass
filter where we filter out using an ideal band pass filter this component.
And eliminate these additional spectral components.
Well then at the output of the band pass filter,
because the spectrum now consist of a single spike on the frequency spectrum.
We know that it would be a sinusoidal wave form.
So, by band pass filtering a square wave, we can generate a sine wave.
If we band pass filtered out this component, we would generate a sine wave
at 3 kilohertz, rather than at the fundamental of 1 kilohertz.
If we filtered this one, we could generate a 5 kilohertz sine wave.
Now let's look at the measurements we're going to make.
I've built a relaxation oscillator that generates a 1 kilohertz square wave.
We're going to apply that square wave to the input of a Sallen-Key band pass
filter.
Having a center frequency of 1 kilohertz and
a Q equals 5 design using techniques we talked about in our previous lesson.
We'll look at the frequency spectrum and the signal and time domain here.
And we'll also look at the spectrum and
time domain waveform here to see how the filter affects the input square wave.
We're then going to cascade this filter with another identical filter to improve
the filtering and then examine the output waveform.
We'll then cascade a third Sallen-Key band pass filter.
And look at the output wave form after its been filtered through three band pass
filters and compare it to the input square wave.
Now as we make this measurements, we're going to look at a figure of merit known
as the Total Harmonic Distortion or THD.
THD is a numerical indicator of the amount of distortion present in a sine wave.
A pure sine wave, having a frequency spectrum that looks like this,
a single spike, would have a THD equal to zero.
In the formula here, v2 is the voltage of the second harmonic,
v3 is the voltage of the third harmonic, fourth harmonic, etc.
A pure sine wave at n = 1 here would have no upper harmonics.
The numerator would be zero, and its THD would be zero.
Indicating a that it's a pure sine wave with no distortion.
Now in this application we're talking about here,
the conversion of a square wave to a sine wave.
We can consider that square wave to be a highly distorted 1 kilohertz sine wave.
So here we have an n = 3 component, an n = 5 component an n = 7 component, etc.
So our THD from this formula would be non-zero.
Now as we filter it, filter this component through one band pass filter
through a second band pass filter, and through a third band pass filter.
We would expect these components to go to 0.
And the THD of our waveform would approach 0%.
Ideally approaching 0% if we were able to eliminate all of these
upper harmonics from the square wave.
Now let's look at some measurements.
So here's the constructed circuit.
This portion here is the relaxation oscillator its output is
applied to a potentiometer so that I can adjust the level of the square wave.
I have a unity gain buffer here that isolates the output of the relaxation
oscillator from this cascade of three Sallen-Key band pass filters.
Let's first use the NI Elvis Bode analyzer to generate a Bode magnitude plot for
one of the Sallen-Key band pass filters
As the analyzer runs, it applies sine waves to the input of the filter.
Measures the output sine wave and
then calculates the gain at each of those frequencies.
You can see that the Bode magnitude plot
is a band pass filter centered at 1 kilohertz.
And if we measured the quality factor of this band pass filter,
it would be close to a q equal to five.
And let's examine the output of the relaxation oscillator
both on the oscilloscope and
using the dynamic signal analyzer to display the frequency spectrum.
Click run, and there's the output of the relaxation oscillator.
It's approximately a 1 kilohertz square wave with a peak to peak amplitude of 20.9
volts or so.
Now on the dynamic signal analyzer.
There is its frequency spectrum.
So there's the fundamental component at 1 kilohertz, like we'd expect.
And here are the upper level harmonics at 3 kilohertz, 5 kilohertz, 7 kilohertz,
9 kilohertz.
I've limited the spectrum to just DC to 10 kilohertz.
Now I'm going to take that relaxation oscillator output and
apply it to the input of one of our band pass filters.
And then we are going to examine the output of the band pass filter.
Now let's monitor the output of the relaxation oscillator on
channel 0 on the oscilloscope.
And look at the output of the band pass filter on channel 1.
So in green is the input to the band pass filter and the output is in blue.
And you can see that just by filtering through this single band pass filter
the second order band pass filter centered at 1 kilohertz.
The output is already approaching that of a sine wave.
If we look at the dynamic signal analyzer to look at the spectrum
of the output signal, let me change the source channel
to 1, And let it finish averaging.
You can see that on this scale already the fundamental component is much,
much larger than the distortion components.
And the distortion components are essentially 0 on this scale.
If I change the.
Scale, so that we have.
There we go, that's a reasonable scale.
From 0 to 1, you can see that there's still the 3 kilohertz component is visible
on the scale and the 5 kilohertz, there's a small blip there.
Now let's take this output, the output of this band pass filter and
apply it to another bandpass filter to see how the waveform is affected.
So, there's a cascade of two band pass filters.
You can see the output is essentially a sine wave with the square wave input.
So, we've cascaded two band pass filters second order at 1 kilohertz.
And applied a square wave to the input to the cascade,
the output looks like this sine wave.
Let me increase the gain a little bit.
And adjust the time base a little bit, there we go.
So the input square wave, output sine wave, and on the frequency spectrum,
You can see that essentially you have only the fundamental component at 1 kilohertz.
The THD after this filter is 0.89%, which indicates a pretty clean sine wave.
If we go back and look at the output after the first filter.
With these additional components here, let's wait for the averaging to stop.
And you can see that we have a THD at 6.5% which is still a reasonably clean
sine wave as you can see in the time domain waveform.
So after one filter we have a THD of 6% after two filters,
we have a THD of approximately 0.88%.
And let's add in the third filter to see what it's effect is.
Go back to the oscilloscope, hit run.
And change the scale, there we go.
So input square wave, this is our output after three band pass filters.
And on the dynamic signal analyzer.
We have a THD of 0.12 or essentially a very clean,
pure sine wave after filtering three times.
Now we've looked at various wave forms both before and after filtering.
In both the time domain and the frequency domain.
Now I wanted to do one more test for you.
I wanted to play this 1 kilohertz tone for you.
Both of the output of the relaxation oscillator,
a square wave with all the harmonic content.
And I was going to play for you the 1 kilohertz tone after filtering.
To see if you can hear the difference that the harmonic content makes.
So first let's listen to the output of the relaxation oscillator, the square wave.
[SOUND] Do you hear the harshness of that?
Compared with, here's the output of the third band pass filter.
[SOUND] Essentially a pure sine wave.
So there's our pure 1 kilohertz tone.
And we can compare that with [SOUND] our 1 kilohertz
square wave tone that contains all of the harmonic content.
So one more time.
[SOUND] A pure sine wave.
[SOUND] Harmonious, melodic,
you can listen to it all day and
a 1 kilohertz square wave,
a harsh, grating tone.
So in summary, during this lesson we introduced frequency spectra.
And we looked at how a real circuit could be used to extract a sinusoidal component
from a square wave input.
So thank you and until next time.